#include "e2d/core/EntityMap.h"
#include "e2d/core/Entity.h"


e2d::EntityMap::EntityMap(e2d::Entity* entity)
	:m_Entity(entity)
{
	if(entity)
		m_UUID = entity->m_UUID;
}


bool e2d::EntityMap::LoadFromScene(e2d::Scene* scene)
{
	if (m_UUID.empty())
	{
		return false;
	}
	bool res = scene->HasEntity(this->m_UUID);
	if (res)
	{
		this->m_Entity = scene->GetEntity(this->m_UUID).get();
	}
	return res;
};

std::string e2d::EntityMap::EntityName() const
{
	if (m_Entity)
	{
		return m_Entity->m_Name;
	}
	return "None";
}
